<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
   <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<c:choose>
	<c:when test="${user != null}">
		<%-- <c:if test="${usertype == 'Admin User'}">
			<jsp:forward page="404.jsp" />
		</c:if> --%>
	</c:when>
	<c:otherwise>
		<jsp:forward page="login.jsp" />
	</c:otherwise>
</c:choose>
<!-- start content -->
<div id="content">
	<div id="page-heading">
		<h1>VIEW TRANSACTIONS</h1>
		<h2><font color="blue">${message}</font></h2>
		<h2><font color="blue">${error}</font></h2>
	</div>
	<!--  start top-search -->
	<div id="top-search">
		
		<form action="searchTransaction.html" method="post">
			<table border="0" cellpadding="0" cellspacing="0">
				<tr>
					<td><input type="text" name="idcard" value=""  class="top-search-inp"  placeholder="Id Card Number"/></td>
					<td>
					<input type="date" id="startdatepicker" name="fday" value="" class="top-search-inp" placeholder="From date">
					</td>
					<td>
					<input type="date" id="enddatepicker" name="tday" value=""  class="top-search-inp" placeholder="To date">
					</td>
					<td>
					<input type="submit" class="btnReject" value="Search"></input></td>
					</td>
				</tr>
			</table>
		</form>
		
		
	</div>
 	<!--  end top-search -->
	<!-- end page-heading -->

	<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
	<tr>
		<th rowspan="3" class="sized"><img src="resource/images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
		<th class="topleft"></th>
		<td id="tbl-border-top">&nbsp;</td>
		<th class="topright"></th>
		<th rowspan="3" class="sized"><img src="resource/images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
	</tr>
	<tr>
		<td id="tbl-border-left"></td>
		<td>
		<!--  start content-table-inner ...................................................................... START -->
		<div id="content-table-inner">
		
			<!--  start table-content  -->
			<div id="table-content">
		 
				<!--  start customer information -->
				<h1 style="padding-bottom: 12px;">Customer Information</h1>
				<form id="mainform1" action="">
				<!-- start customer table -->
				<table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
				<!-- Display number of info in a page ------------------------------------- START-->
					<thead>
					
<!-- 						<tr> -->
						
<!-- 							<th>Show  -->
<!-- 							<select name="mytable_length" aria-controls="mytable" class=""> -->
<!-- 								<option value="10">10</option> -->
<!-- 								<option value="25">25</option> -->
<!-- 								<option value="50">50</option> -->
<!-- 								<option value="100">100</option> -->
<!-- 							</select></th> -->
							
<!-- 						</tr> -->
						<!-- Display number of info in a page ------------------------------------- END-->
						<tr>
							<th class="table-header-repeat line-left"><a href="">Account Number</a></th>
							<th class="table-header-repeat line-left minwidth-1"><a href="">IDcard Number</a>	</th>
							<th class="table-header-repeat line-left minwidth-1"><a href="">Customer Last Name</a></th>
							<th class="table-header-repeat line-left"><a href="">Customer First Name</a></th>
							
							<th class="table-header-repeat line-left"><a href="">Status</a></th>
						</tr>
					</thead>
					<tbody>
						<c:choose>
							<c:when test="${viewAccounts.size() > 0}">
								<c:forEach items="${viewAccounts}" var="acc">
									<tr class="alternate-row">
										<td>
										<a href="viewTransactionByAccountId.html?accountId=${acc.accountId}">${acc.accountNumber}</a>
										
										</td>
										
										<td>${acc.idCustomer.idCardNumber}</td>
										<td>${acc.idCustomer.lastName}</td>
										<td>${acc.idCustomer.firstName}</td>
										<td>${acc.idState.nameState}</td>
									</tr>
<%-- 									<input type="hidden" name="accountId" value="${acc.accountId}"/> --%>
								</c:forEach>
													
							</c:when>
							<c:otherwise>
								<tr class="alternate-row">
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>						
								</tr>
							</c:otherwise>
						</c:choose>
						
						
				</tbody>
				</table>
				<!--  end customer-table................................... --> 
				</form>
				<!-- end customer information -->
		 
				<!--  start Transaction-table ..................................................................................... -->
				<h1 style="padding-bottom: 12px;">Transactions Information</h1>
				<form id="mainform" action="">
				<table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
				<thead>
					<tr>
						<th class="table-header-repeat line-left"><a href="">No.</a>	</th>
						<th class="table-header-repeat line-left minwidth-1"><a href="">Begin Time</a></th>
						<th class="table-header-repeat line-left minwidth-1"><a href="">End time</a></th>
						<th class="table-header-repeat line-left"><a href="">Type</a></th>
						<th class="table-header-repeat line-left"><a href="">Sender Name</a></th>
						<th class="table-header-repeat line-left"><a href="">Receiver Name</a></th>
						<th class="table-header-repeat line-left"><a href="">Status</a></th>
						<th class="table-header-repeat line-left"><a href="">Amount</a></th>
						<th class="table-header-repeat line-left"><a href="">Supporter</a></th>
						<th class="table-header-repeat line-left"><a href="">Administrator</a></th>
						<th class="table-header-repeat line-left"><a href="">Comment</th>
					</tr>
				</thead>
				<tbody>
					<c:choose>
							<c:when test="${viewTransactions.size() > 0}">
								<c:forEach items="${viewTransactions}" var="tr" varStatus="no">
									<tr class="alternate-row">
										<td>${no.count}</td>
										<td>${tr.beginTime}</td>
										<td>${tr.endTime}</td>
										<td>${tr.transactionType}</td>
										<td>${tr.sendAccountId.idCustomer.firstName}</td>
										<td>${tr.receiveAccountId.idCustomer.firstName}</td>
										<td>${tr.transactionStatus}</td>
										<td>${tr.changeAmount}</td>
										<td>${tr.userSupportId.userName}</td>
										<td>${tr.userAdminId.userName}</td>
										<td>${tr.comment}</td>
									</tr>
								</c:forEach>
													
							</c:when>
							<c:otherwise>
								<tr class="alternate-row">
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>	
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>	
									<td></td>				
								</tr>
							</c:otherwise>
						</c:choose>
						
				</tbody>
				</table>
				<!--  end Transaction-table................................... --> 
				</form>
			</div>
			<!--  end content-table  -->
		
			<!--  start actions-box ............................................... -->
			<!-- end actions-box........... -->
			
						
<!-- 			<div id="mytable_info" class="dataTables_info" role="status" aria-live="polite">Showing 1 to 5 of 5 entries</div> -->
			<!--  start paging..................................................... -->
<!-- 			<table border="0" cellpadding="0" cellspacing="0" id="paging-table"> -->
<!-- 			<tr> -->
		
			
			
<!-- 			<td> -->
<!-- 				<a href="" class="page-far-left"></a> -->
<!-- 				<a href="" class="page-left"></a> -->
<!-- 				<div id="page-info">Page <strong>1</strong> / 15</div> -->
<!-- 				<a href="" class="page-right"></a> -->
<!-- 				<a href="" class="page-far-right"></a> -->
<!-- 			</td> -->
			
<!-- 			</tr> -->
<!-- 			</table> -->
			<!--  end paging................ -->
			<div class="clear"></div>
		 
		</div>
		<!--  end content-table-inner ............................................END  -->
		</td>
		<td id="tbl-border-right"></td>
	</tr>
	<tr>
		<th class="sized bottomleft"></th>
		<td id="tbl-border-bottom">&nbsp;</td>
		<th class="sized bottomright"></th>
	</tr>
	</table>
	<div class="clear">&nbsp;</div>

</div>
<!--  end content -->

